// send.js
const nodemailer = require('nodemailer');

async function main() {
  // 创建 SMTP 传输器
  const transporter = nodemailer.createTransport({
    host: 'smtp.163.com',
    port: 465,
    secure: true,
    auth: {
      user: 'yxqsir@163.com',
      pass: 'BSfSCFtwTbDAfLg3'
    }
  });

  // 设置邮件内容
  const info = await transporter.sendMail({
    from: 'yxqsir@163.com',
    to: "992620216@qq.com",
    subject: "测试邮件",
    text: "你好，这是一封测试邮件（文本版）",
    html: "<h3>你好，这是一封测试邮件（HTML版）</h3>",
  });

  console.log("邮件发送成功，ID：", info.messageId);
}

main().catch(console.error);
